package com.springboot.blog.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.springboot.blog.interfaces.ToolInterface;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 友情链接表
 * </p>
 *
 * @author 4vsy
 * @since 2020-12-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class Blogroll implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "ID不能为空!",groups={ToolInterface.update.class})
    private Integer id;

    /**
     * 友链网站名称
     */
    @NotBlank(message = "网站名称不能为空!",groups={ToolInterface.insert.class,ToolInterface.update.class})
    private String name;

    /**
     * 友情链接
     */
    @NotBlank(message = "友情链接不能为空!",groups={ToolInterface.insert.class,ToolInterface.update.class})
    private String blogroll;

    /**
     * 排序
     */
    @Range(min =1,max = 255,message = "排序必须大于1小于255!",groups={ToolInterface.insert.class,ToolInterface.update.class})
    private Integer sorts;

    /**
     * 是否显示
     */
    @NotNull(message = "友情链接显示状态不能为空!",groups={ToolInterface.insert.class,ToolInterface.update.class})
    private Boolean status;

    /**
     * 添加时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


}
